function res = SecondBestStep1IC(c,c_,y_,w,w1,pw,phi,xi,pr)

if pr.gam==1
res =  log(c)  - (w*xi/pr.Om/(pw+phi+(xi*c-pw-phi)*(w/w1)^(1+pr.sig)))^((1+pr.sig)/pr.sig)*pr.Om/(1+pr.sig)...
     - log(c_) + pr.Om*(y_/w).^(1+pr.sig)/(1+pr.sig);
else
res =  c^(1-pr.gam)/(1-pr.gam)  - (w*xi/pr.Om/(pw+phi+(xi*c^pr.gam-pw-phi)*(w/w1)^(1+pr.sig)))^((1+pr.sig)/pr.sig)*pr.Om/(1+pr.sig)...
     - c_^(1-pr.gam)/(1-pr.gam) + pr.Om*(y_/w).^(1+pr.sig)/(1+pr.sig);
end